package com.jxstjh.conch.common.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.ToString;

/**
 * 消息类型枚举
 */
@Getter
@ToString
@AllArgsConstructor
public enum MessageTypeEnum {

    NOTICE(10,"通知类消息","notice"),
    BUSINESS(20,"业务类消息","business"),
    AUTH_CODE(30,"验证码消息","auth_code")
    ;

    private Integer code;
    private String description;
    private String codeEn;

    /**
     * 通过code获取enum
     */
    public static MessageTypeEnum getEnumByCode(Integer code) {
        MessageTypeEnum[] values = values();
        for (MessageTypeEnum value : values) {
            if (value.getCode().equals(code)) {
                return value;
            }
        }
        return null;
    }
}